package handler

import (
	"chat/chat-box/initernal/dto"
	"chat/chat-box/initernal/model"
	"chat/chat-box/response"
	"github.com/gin-gonic/gin"
	"strconv"
)

func Find(c *gin.Context) {

	var friend model.Friend
	uid := c.Query("user_id")
	atoi, err := strconv.Atoi(uid)
	if err != nil {
		return
	}
	friend.UserId = atoi

	err = dto.Find(&friend, atoi)
	if err != nil {
		response.Error(c, "查询失败")
		return
	} else {
		response.Success(c, "查询成功", &friend)
	}

}
